home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
gnu
/
emacs
/
emacs1857
/
src_d2.zoo
/
source
/
lisp.h
< prev
next >
Wrap
C/C++ Source or Header
|
1991-12-02
|
34KB
|
994 lines
/* Fundamental definitions for GNU Emacs Lisp interpreter.
Copyright (C) 1985, 1986, 1987 Free Software Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Define the fundamental Lisp data structures */
/* This is the set of Lisp data types */
enum Lisp_Type
{
/* Integer. object.v.integer is the integer value. */
Lisp_Int,
/* Symbol. object.v.symbol points to a struct Lisp_Symbol. */
Lisp_Symbol,
/* Marker (editor pointer). object.v.marker points to a struct Lisp_Marker. */
Lisp_Marker,
/* String. object.v.string points to a struct Lisp_String.
The length of the string, and its contents, are stored therein. */
Lisp_String,
/* Vector of Lisp objects. object.v.vector points to a struct Lisp_Vector.
The length of the vector, and its contents, are stored therein. */
Lisp_Vector,
/* Cons. object.v.cons points to a struct Lisp_Cons. */
Lisp_Cons,
/* >>> No longer used */
Lisp_Object_Unused_1,
#if 0
was...
/* Treated like vector in GC, except do not set its mark bit.
Used for internal data blocks that will be explicitly freed
but which, while active, are reached by GC mark exactly once
and should be marked through like a vector. */
Lisp_Temp_Vector,
#endif 0
/* Editor buffer. obj.v.buffer points to a struct buffer.
No buffer is ever truly freed; they can be "killed", but this
just marks them as dead. */
Lisp_Buffer,
/* Built-in function. obj.v.subr points to a struct Lisp_Subr
which describes how to call the function, and its documentation,
as well as pointing to the code. */
Lisp_Subr,
/* Internal value return by subroutines of read.
The user never sees this data type.
Its value is just a number. */
Lisp_Internal,
/* Forwarding pointer to an int variable.
This is allowed only in the value cell of a symbol,
and it means that the symbol's value really lives in the
specified int variable.
obj.v.intptr points to the int variable. */
Lisp_Intfwd,
/* Boolean forwarding pointer to an int variable.
This is like Lisp_Intfwd except that the ostensible "value" of the symbol
is t if the int variable is nonzero, nil if it is zero.
obj.v.intptr points to the int variable. */
Lisp_Boolfwd,
/* Object describing a connection to a subprocess.
It points to storage of type struct Lisp_Process */
Lisp_Process,
/* Forwarding pointer to a Lisp_Object variable.
This is allowed only in the value cell of a symbol,
and it means that the symbol's value really lives in the
specified variable.
obj.v.objfwd points to the Lisp_Object variable. */
Lisp_Objfwd,
/* was Lisp_Internal */
Lisp_Object_Unused_2,
/* Used when a FILE * value needs to be passed
in an argument of type Lisp_Object.
You must do (FILE *) obj.v.integer to get the value.
The user will never see this data type. */
Lisp_Internal_Stream,
/* Used in a symbol value cell when the symbol's value is per-buffer.
The actual contents are a cons cell which starts a list like this:
(REALVALUE BUFFER CURRENT-ALIST-ELEMENT . DEFAULT-VALUE)).
BUFFER is the last buffer for which this symbol's value was
made up to date.
CURRENT-ALIST-ELEMENT is a pointer to an element of BUFFER's
b_local_var_alist, that being the element whose car is this variable.
Or it can be a pointer to the (CURRENT-ALIST-ELEMENT . DEFAULT-VALUE), if BUFFER
does not have an element in its alist for this variable
(that is, if BUFFER sees the default value of this variable).
If we want to examine or set the value and BUFFER is current,
we just examine or set REALVALUE.
If BUFFER is not current, we store the current REALVALUE value into
CURRENT-ALIST-ELEMENT, then find the appropriate alist element for
the buffer now current and set up CURRENT-ALIST-ELEMENT.
Then we set REALVALUE out of that element, and store into BUFFER.
If we are setting the variable and the current buffer does not have
an alist entry for this variable, an alist entry is created.
Note that REALVALUE can be a forwarding pointer.
Each time it is examined or set, forwarding must be done. */
Lisp_Buffer_Local_Value,
/* Like Lisp_Buffer_Local_Value with one difference:
merely setting the variable while some buffer is current
does not cause that buffer to have its own local value of this variable.
Only make-local-variable does that. */
Lisp_Some_Buffer_Local_Value,
/* Like Lisp_Objfwd except that value lives in a slot
in the current buffer. Value is byte index of slot within buffer */
Lisp_Buffer_Objfwd,
/* In symbol value cell, means var is unbound.
In symbol function cell, means function name is undefined. */
Lisp_Void,
/* Window used for Emacs display.
Data inside looks like a Lisp_Vector. */
Lisp_Window,
/* Used by save,set,restore-window-configuration */
Lisp_Window_Configuration
};
#ifndef NO_UNION_TYPE
#ifndef BIG_ENDIAN
/* Definition of Lisp_Object for little-endian machines. */
typedef
union Lisp_Object
{
/* Used for comparing two Lisp_Objects;
also, positive integers can be accessed fast this way. */
int i;
struct
{
int val: 24;
char type;
} s;
struct
{
unsigned int val: 24;
char type;
} u;
struct
{
unsigned int val: 24;
enum Lisp_Type type: 7;
/* The markbit is not really part of the value of a Lisp_Object,
and is always zero except during garbage collection. */
unsigned int markbit: 1;
} gu;
}
Lisp_Object;
#else /* If BIG_ENDIAN */
typedef
union Lisp_Object
{
/* Used for comparing two Lisp_Objects;
also, positive integers can be accessed fast this way. */
int i;
struct
{
char type;
int val: 24;
} s;
struct
{
char type;
unsigned int val: 24;
} u;
struct
{
/* The markbit is not really part of the value of a Lisp_Object,
and is always zero except during garbage collection. */
unsigned int markbit: 1;
enum Lisp_Type type: 7;
unsigned int val: 24;
} gu;
}
Lisp_Object;
#endif BIG_ENDIAN
#endif NO_UNION_TYPE
/* If union type is not wanted, define Lisp_Object as just a number
and define the macros below to extract fields by shifting */
#ifdef NO_UNION_TYPE
#define Lisp_Object int
/* These values are overridden by the m- file on some machines. */
#ifndef VALBITS
#define VALBITS 24
#endif
#ifndef GCTYPEBITS
#define GCTYPEBITS 7
#endif
#ifndef VALMASK
#define VALMASK ((1<<VALBITS) - 1)
#endif
#define GCTYPEMASK ((1<<GCTYPEBITS) - 1)
#define MARKBIT (1 << (VALBITS + GCTYPEBITS))
#endif /* NO_UNION_TYPE */
/* These macros extract various sorts of values from a Lisp_Object.
For example, if tem is a Lisp_Object whose type is Lisp_Cons,
XCONS (tem) is the struct Lisp_Cons * pointing to the memory for that cons. */
#ifdef NO_UNION_TYPE
/* One need to override this if there must be high bits set in data space
(doing the result of the below & ((1 << (GCTYPE + 1)) - 1) would work
on all machines, but would penalise machines which don't need it)
*/
#ifndef XTYPE
#define XTYPE(a) ((enum Lisp_Type) ((a) >> VALBITS))
#endif
#ifndef XSETTYPE
#define XSETTYPE(a, b) ((a) = XUINT (a) | ((int)(b) << VALBITS))
#endif
/* Use XFASTINT for fast retrieval and storage of integers known